package com.charlessong.unionpay.controller;

import com.charlessong.unionpay.domain.AjaxResult;
import com.charlessong.unionpay.service.IPayService;
import com.charlessong.unionpay.utils.SpringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author charles
 * @Date 2021/11/18
 */
@RestController
@RequestMapping("/api")
public class PayApiController {

    @PostMapping("/qryOrder")
    public AjaxResult qryOrder(String appid, String body, String secret) {
        return AjaxResult.success();
    }

    @PostMapping("/requestPay")
    public AjaxResult requestPay(String appid, String body, String secret) {

        IPayService payService = SpringUtils.getBean(body);
        return payService.requestPay(body);
    }

    @PostMapping("/payResultNotice")
    public AjaxResult payResultNotice(String appid, String body, String secret) {
        return AjaxResult.success();
    }
}
